package com.xsherl.leetcode.utils;

import com.xsherl.leetcode.base.ListNode;
import com.xsherl.leetcode.base.TreeNode;

import java.util.Arrays;
import java.util.List;

public class PrintUtils {

    public static void println(int[] arr){
        System.out.println(Arrays.toString(arr));
    }

    public static void println(long[] arr){
        System.out.println(Arrays.toString(arr));
    }

    public static void println(double[] arr){
        System.out.println(Arrays.toString(arr));
    }

    public static void println(boolean[] arr){
        System.out.println(Arrays.toString(arr));
    }

    public static void println(Object... arr){
        System.out.println(Arrays.toString(arr));
    }

    public static void println(int[][] arrs){
        System.out.println("[");
        for (int[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static void println(char[][] arrs){
        System.out.println("[");
        for (char[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static void println(long[][] arrs){
        System.out.println("[");
        for (long[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static void println(double[][] arrs){
        System.out.println("[");
        for (double[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static void println(boolean[][] arrs){
        System.out.println("[");
        for (boolean[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static void println(Object[][] arrs){
        System.out.println("[");
        for (Object[] arr : arrs) {
            System.out.println("\t" + Arrays.toString(arr));
        }
        System.out.println("]");
    }

    public static<T extends Object> void println(List<T> arrs){
        System.out.println("[");
        for (T arr : arrs) {
            System.out.println("\t" + arr);
        }
        System.out.println("]");
    }

    public static void println(String s){
        System.out.println(s);
    }

    public static void println(TreeNode root){
        TreeUtils.print(root);
    }

    public static void println(ListNode head){
        System.out.println(head);
    }
}
